package com.idbk.chargestation.bean;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import com.google.gson.annotations.SerializedName;

/**
 * 我的预约 列表项
 * @author lupc,zhx
 *
 */
public class JsonMyBookingItem {

	/**
	 * 预约中
	 */
	public final static int BESPEAK_STATUS_IN = 1;
	/**
	 * 主动取消
	 */
	public final static int BESPEAK_STATUS_CANCEL_SELF = 2;
	/**
	 * 超时取消
	 */
	public final static int BESPEAK_STATUS_CANCEL_TIMEOUT = 3;
	/**
	 * 已完成
	 */
	public final static int BESPEAK_STATUS_FINISH = 4;
	
	@SerializedName("id")
	public int pointId;
	
	@SerializedName("pointName")
	public String pointName;
	
	@SerializedName("pileNum")
	public int pileNum;
	
	@SerializedName("pileSn")
	public String pileSn;
	
	@SerializedName("lat")
	public double lat;
	
	@SerializedName("lng")
	public double lng;
	
	@SerializedName("address")
	public String address;
	
	@SerializedName("imageURLs")
	public String imageURLs;
	
	@SerializedName("startTime")
	public Date startTime;
	
	@SerializedName("stopTime")
	public String stopTime;
	
	@SerializedName("deadline")
	public Date deadline;
	
	/**
	 * 完成或者取消时所花费的时间，单位：秒
	 */
	@SerializedName("costTime")
	public int costTime;
	
	/**
	 * 服务费用
	 */
	@SerializedName("priceService")
	public double priceService;
	
	/**
	 * 服务收费类型
	 */
	@SerializedName("serviceEnum")
	public int serviceEnum;
	
	/**
	 * 当前预约状态
	 */
	@SerializedName("bespeakStatue")
	public int bespeakStatue;
	
	/**
	 * 预约金额，单位：元
	 */
	@SerializedName("bespeakMoney")
	public double bespeakMoney;
	
	/**
	 * 预约消费，单位：元
	 */
	@SerializedName("expenseMoney")
	public double expenseMoney;
	
	
	/**
	 * 获取 预约剩余时间
	 * @return
	 */
	public int getBookRemainMinutes(){
		long start = startTime.getTime();
		long end = deadline.getTime();
		if(end < start){
			return 0;
		} else {
			long during = end - start;
			long cost=costTime*1000;
			long diffrence=during - cost;
			int r =(int) diffrence/1000/60;
			return r;
		}		
	}
	
	public String getSimpleEndTime(){
		SimpleDateFormat sdf = new SimpleDateFormat("HH:mm",Locale.CHINA);
		return sdf.format(startTime);
	}
	
}
